From 1b0d3f865246f71c2738e62a0d332c78ccfd1ba3 Mon Sep 17 00:00:00 2001 From: robertl Date: Sun, 5 Apr 2009 20:57:18 +0000 Subject: [PATCH] Add Wintec WBT-1000 support. --- wbt-200.c | 35 +++++++++++++++++++++++++++++++---- xmldoc/formats/wbt.xml | 1 + 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/wbt-200.c b/wbt-200.c index c4d0221d9..a4cfc8381 100644 --- a/wbt-200.c +++ b/wbt-200.c @@ -93,7 +93,7 @@ static char *port; static char *erase; static enum { - UNKNOWN, WBT200, WBT201 + UNKNOWN, WBT200, WBT201, WSG1000 } dev_type = UNKNOWN; struct buf_chunk { @@ -338,6 +338,20 @@ static int wbt201_try() { return expect("@AL"); } +static int wsg1000_try() { + int rc; + + db(1, "Trying WSG 1000/G-Rays 2\n"); + + if ((rc = gbser_set_port(fd, WBT201BAUD, 8, 0, 1))) { + db(1, "Set baud rate to %d failed (%d)\n", WBT201BAUD, rc); + return 0; + } + + wr_cmdl("@AL,2,3"); + return expect("@AL,2,3,OK"); +} + static int guess_device() { int i; db(1, "Guessing device...\n"); @@ -348,8 +362,12 @@ static int guess_device() { if (wbt201_try()) { return WBT201; } + if (wsg1000_try()) { + return WSG1000; + } } return UNKNOWN; + } static void rd_init(const char *fname) { @@ -844,8 +862,15 @@ static int wbt201_read_chunk(struct read_state *st, unsigned pos, unsigned limit } /* ack */ - rd_line(BUFSPEC(line_buf)); +/* rd_line(BUFSPEC(line_buf)); return starts_with(line_buf, cmd_buf); +*/ + if (dev_type == WBT201){ + rd_line(BUFSPEC(line_buf)); + return starts_with(line_buf, cmd_buf); + } + return 1; + } static void wbt201_data_read(void) { @@ -993,13 +1018,15 @@ static void file_read(void) { static void data_read(void) { switch (dev_type) { - case WBT200: + case WBT200: wbt200_data_read(); break; - case WBT201: wbt201_data_read(); break; + case WSG1000: + wbt201_data_read(); + break; default: fatal(MYNAME ": Unknown device type (internal)\n"); diff --git a/xmldoc/formats/wbt.xml b/xmldoc/formats/wbt.xml index 8a1845077..1fa9f10af 100644 --- a/xmldoc/formats/wbt.xml +++ b/xmldoc/formats/wbt.xml @@ -1,6 +1,7 @@ Serial download protocol for the Wintec WBT-200 and Wintec WBT-201 +Wintec WBT-1000 GPS data loggers. Although untested it is expected that this will also support the WBT-100. Wintec WBT-201 -- 2.30.2